package com.itheima.controller.admin;

import com.itheima.common.result.Result;
import com.itheima.pojo.SysMenu;
import com.itheima.service.IndexService;
import com.itheima.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("sys_menu")
public class SysMenuController {
    @Autowired
    SysMenuService sysMenuService;

    @GetMapping("allData")
    public Result allData(){
        return sysMenuService.menuList();
    }
    @GetMapping("rowInfo")
    public Result rowInfo(Integer id){
        return sysMenuService.rowInfo(id);
    }

    @PostMapping("update")
    public Result update(@RequestBody SysMenu sysMenu){
        return sysMenuService.menuUpdate(sysMenu);
    }

    @PostMapping("add")
    public Result add(@RequestBody SysMenu sysMenu){
        return sysMenuService.menuAdd(sysMenu);
    }

    @GetMapping("del")
    public Result delete(Integer id){
        return sysMenuService.delete(id);
    }

}
